
const Mock = require('mockjs'); // 假数据

module.exports = function (app) {
    const prefix = '/api/unit/';

    app.get(prefix + 'bigData1000', (req, res) => {
        const code = 200;
        const msg = '';
        const data = Mock.mock({ // 生成
            'list|1000': [{
                'id': '@increment(1000)',
                'name': '@cname'
            }]
        });
        const time = +(new Date);
        const result = {code, data, msg, time};
        return res.end(JSON.stringify(result));
    });
    app.get(prefix + 'bigData2000', (req, res) => {
        const code = 200;
        const msg = '';
        const data = Mock.mock({ // 生成
            'list|2000': [{
                'id': '@increment(2000)',
                'name': '@cname'
            }]
        });
        const time = +(new Date);
        const result = {code, data, msg, time};
        return res.end(JSON.stringify(result));
    });
    app.get(prefix + 'bigData3000', (req, res) => {
        const code = 200;
        const msg = '';
        const data = Mock.mock({ // 生成
            'list|3000': [{
                'id': '@increment(3000)',
                'name': '@cname'
            }]
        });
        const time = +(new Date);
        const result = {code, data, msg, time};
        return res.end(JSON.stringify(result));
    });
};
